//
//  BaseView.m
//  WalkUp
//
//  Created by 李沛池 on 16/10/21.
//  Copyright © 2016年 LPC. All rights reserved.
//

#import "BaseView.h"

@implementation BaseView

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self layoutIfNeeded];
}

- (UIViewController*)viewController
{
    for (UIView* next = [self superview]; next; next = next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}

- (void)updateData:(id)item
{
    
}

- (void)actionBlock:(BaseViewBlock)block
{
    _bvBlock = block;
}

- (void)delegateAction:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(viewActionWithSender:withView:withObject:)])
    {
        [self.delegate viewActionWithSender:sender withView:self withObject:self.obj];
    }
}

@end
